<!-- subpkg_consult/order_list/index.vue -->
<script setup>
	import { ref } from 'vue'

	// 订单列表组件
	import orderList from './components/order-list.vue'

	// 标签索引值
	const tabIndex = ref(0)
	// 标签页数据
	const orderTabs = ref([
		{ label: '问医生', type: 1, rendered: true },
		{ label: '极速问诊', type: 2, rendered: false },
		{ label: '开药问诊', type: 3, rendered: false },
	])
	const onOrderTabChange = ({ index }) => {
		tabIndex.value = index
		orderTabs.value[index].rendered = true
	}
</script>
<template>
	<view class="consult-page">
		<view class="consult-status-tabs">
			<custom-tabs :list="orderTabs" @click="onOrderTabChange"></custom-tabs>
		</view>

		<!-- 订单列表 -->
		<view
			v-for="(order, index) in orderTabs"
			:key="order.label"
			v-show="tabIndex === index"
		>
			<order-list :type="order.type" v-if="order.rendered" />
		</view>
	</view>
</template>

<style lang="scss">
	@import './index.scss';
</style>
